package tk.xboot.flink.cep.mc.events;

public class PowerEvent extends MonitoringEvent {
    private double voltage;

    public PowerEvent(int rackId, double valtage) {
        super(rackId);
        this.voltage = valtage;
    }

    public double getVoltage() {
        return voltage;
    }

    public void setVoltage(double voltage) {
        this.voltage = voltage;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof PowerEvent) {
            PowerEvent pe = (PowerEvent) obj;
            return pe.canEquals(this) && super.equals(pe) && voltage == pe.voltage;
        }

        return false;
    }

    @Override
    public int hashCode() {
        return 41 * super.hashCode() + Double.hashCode(voltage);
    }

    @Override
    public String toString() {
        return "(Power Event " + getRackId() + " , " + getVoltage() + ")";
    }

    public boolean canEquals(Object object) {
        return object instanceof PowerEvent;
    }

}
